package project2011;

/**
 * Manages product details 
 * @author Antone Gonzalez
 */
public class Product {
    /**
     * The constructor for Product.
     * @param upc UPC number
     * @param name Product name
     * @param price Product price
     */
    public Product(int upc, String name, double price, String vendorName)
    {
        UPC = upc;
        productName = name;
        unitPrice = price;
        vendor = vendorName;
    }
    /**
     * Accessor for UPC
     * @return UPC number
     */
    public int getUPC()
    {
        return UPC;
    }
    /**
     * Accessor for product price
     * @return product price
     */
    public double getPrice()
    {
        return unitPrice;
    }
    /**
     * Accessor for product name
     * @return product name
     */
    public String getProductName()
    {
        return productName;
    }
    /**
     * Accessor for product vendor
     * @return vendor name
     */
    public String getVendorName(){
        return vendor;
    }
    
    /**
     * changes the price of this product
     * @param newPrice the new price of the product
     */
    public void changePrice(double newPrice)
    {
        unitPrice = newPrice;
    }
    
    
   /**
     * returns a string with UPC, productName and unitPrice separated by commas
     * @return a string with UPC, productName and unitPrice separated by commas
     */
    public String print()
    {
        String result = UPC + ",";
        result += productName + ",";
        result += unitPrice + ",";
        result += vendor + ",\n";
        
        return result;
    }
    
    private int UPC;
    private String productName;
    private double unitPrice;
    private String vendor;
    
}
